package com.module.aichat.data.bean

import android.os.Parcelable
import com.google.gson.Gson
import com.iyao.eastat.span.DataBindingSpan
import kotlinx.parcelize.Parcelize

enum class ChatMessageType(val type: String, val value: Int) {
    TEXT("text", 1),
    IMAGE("image", 2),
    VOICE("voice", 3),
    VIDEO("video", 4),
    FILE("file", 5),
    COMBINE("combine", 6),
    REFER("refer", 7),
    PROMPT("prompt", 8),
    CMD("cmd", 9),
    GIFT("gift",10),
    LOCATION("location", 11),
    UNKNOWN("unknown", 101);

    companion object {
//        fun fromString(type: String): Int {
//            return values().first { it.type == type }.value
//        }

        fun fromString(type: String): Int {
            return try {
                values().first { it.type == type }.value
            } catch (e: NoSuchElementException) {
                UNKNOWN.value
            }
        }

    }
}

/**
 * 会话类型
 */
enum class ChatSessionType(val type:Int,val value:String) {
    CHAT_NONE(0,"none"),
    CHAT_PRIVATE(1,"private"),
    CHAT_DISCUSSION(3,"discussion"),
    CHAT_GROUP(2,"group"),
    CHAT_CHATROOM(4,"chatroom"),
    CHAT_CUSTOMER_SERVICE(5,"customer_service"),
    CHAT_SYSTEM(6,"system"),
    CHAT_APP_PUBLIC_SERVICE(7,"app_public_service"),
    CHAT_PUBLIC_SERVICE(8,"public_service"),
    CHAT_PUSH_SERVICE(9,"push_service"),
    CHAT_ULTRA_GROUP(10,"ULTRA_GROUP"),
    CHAT_ENCRYPTED(11,"encrypted"),
    CHAT_RTC_ROOM(12,"rtc_room");
}

//标记消息的方向
object MsgDirection{
    const val RECEIVE = 2
    const val SEND = 1
}

/**
 * 消息状态
 */
object MsgStatus {
    //默认状态
    const val DEFAULT = 0
    //已读
    const val READ = 1
    //未读
    const val UNREAD = 2
    //失败
    const val ERROR = 3
}

enum class InputModel {
    MODEL_KEYBOARD,//键盘模式
    MODEL_NONE,//非输入模式模式
    MODEL_EMOJI,//表情模式
    MODEL_MORE//更多模式
}

@Parcelize
data class ChatUser(
    val id: String,
    var name: String
) : Parcelable, DataBindingSpan

@Parcelize
data class FirmAIChatModel(
    val event: String?,
    var answer: String?,
    var task_id: String?,
    var created_at: String?,
    var message_id: String?,
    var conversation_id: String?,
    var data: FirmAIChatDataBean?,
) : Parcelable

@Parcelize
data class FirmAIChatDataBean(
    val status: String?,
    var outputs: FirmAIChatDataPutsBean?,
    val error: String?,
) : Parcelable

@Parcelize
data class FirmAIChatDataPutsBean(
    val answer: String?,
) : Parcelable

@Parcelize
data class MsgFeedbackModel(
    val message_id: String?,
    val rating: String?,
) : Parcelable


